home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows 95 API Bible
/
Windows 95 API Bible 3 Disc Set.iso
/
Win32 API Bible Book 1 of 3
/
CHAPTE21
/
EX10.C
< prev
next >
Wrap
C/C++ Source or Header
|
1995-05-29
|
4KB
|
81 lines
#include <genstub.c>
LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch (uMsg)
{
case WM_DESTROY:
PostQuitMessage( 0 );
break;
case WM_COMMAND:
switch ( LOWORD( wParam ) )
{
case IDM_TEST: // Display system and user defaults.
{
LCID lcidDefault;
LANGID langidDefault;
char szMessage[128];
char szDefaultLanguage[64];
char szDefaultNativeLanguage[64];
char szDefaultCountry[64];
char szDefaultNativeCountry[64];
HDC hDC = GetDC( hWnd );
// Get system default information.
lcidDefault = GetSystemDefaultLCID( );
langidDefault = GetSystemDefaultLangID( );
VerLanguageName( langidDefault, szDefaultLanguage, 63 );
GetLocaleInfo( lcidDefault, LOCALE_SNATIVELANGNAME,
szDefaultNativeLanguage, 63 );
GetLocaleInfo( lcidDefault, LOCALE_SENGCOUNTRY,
szDefaultCountry, 63 );
GetLocaleInfo( lcidDefault, LOCALE_SCOUNTRY,
szDefaultNativeCountry, 63 );
wsprintf( szMessage,
"System Language: %X is %s or %s (native) ",
langidDefault, szDefaultLanguage,
szDefaultNativeLanguage );
TextOut( hDC, 0, 0, szMessage, lstrlen( szMessage ) );
wsprintf( szMessage,
"System Locale: %X is %s or %s (native) ",
lcidDefault, szDefaultCountry,
szDefaultNativeCountry );
TextOut( hDC, 0, 20, szMessage, lstrlen( szMessage ) );
// Get user default information.
lcidDefault = GetUserDefaultLCID( );
langidDefault = GetUserDefaultLangID( );
VerLanguageName( langidDefault, szDefaultLanguage, 63 );
GetLocaleInfo( lcidDefault, LOCALE_SNATIVELANGNAME,
szDefaultNativeLanguage, 63 );
GetLocaleInfo( lcidDefault, LOCALE_SENGCOUNTRY,
szDefaultCountry, 63 );
GetLocaleInfo( lcidDefault, LOCALE_SCOUNTRY,
szDefaultNativeCountry, 63 );
wsprintf( szMessage,
"User Language: %X is %s or %s (native) ",
langidDefault, szDefaultLanguage,
szDefaultNativeLanguage );
TextOut( hDC, 0, 40, szMessage, lstrlen( szMessage ) );
wsprintf( szMessage,
"User Default Locale: %X is %s or %s (native) ",
lcidDefault, szDefaultCountry,
szDefaultNativeCountry );
TextOut( hDC, 0, 60, szMessage, lstrlen( szMessage ) );
ReleaseDC( hWnd, hDC );
}
break;
case IDM_EXIT:
DestroyWindow( hWnd );
break;
}
break;
default:
return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
}
return( NULL );
}